/*
* @Description: router
* @Verson: v1.0
* @Author: xvyy
* @Date: 2024-11-27 15:41
*/
//todo 引入createRouter createWebHashHistory : 创建路由
import {createRouter, createWebHashHistory} from 'vue-router'
import Home from '../components/Home.vue'
import List from "../components/List.vue";
import Add from "../components/Add.vue";
import Update from "../components/Update.vue";

let router = createRouter({
    //设置历史记录访问方式
    history: createWebHashHistory(),
    //当前工程中所有的路由信息
    routes: [
        //一个组件具体的路由信息
        {path: '/', component: Home},
        {path: '/list', component: List,},
        {path: '/add', component: Add},
        {path: '/update/:id', component: Update},
        /*        {
                    path: '/',//组件对应url
                    components:{
                        defaults:Home , //路径访问的默认的组件
                        homeView:Home ,//为组件设置一个名字 后面是组件 前面是名字
                    }
        /!*            component:Home ,//组件
                    name:'home' //路由名称*!/
                } ,
                {
                    path:'/list' ,
                    components:{
                        listView:List ,
                    }
                } ,
                {
                    path:'/add' ,
                    components:{
                        addView:Add ,
                    }
                } ,
                {
                    path:'/update/:id' ,
                    components:{
                        updateView:Update ,
                    }
                }*/
    ]
})

export default router
